import store from './index'  //引入store容器
import { type TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux';
//定义dispatch方法 类型
export type AppDispatch = typeof store.dispatch;
//定义整个store获取状态 类型
export type RootState = ReturnType<typeof store.getState>;
//`返回类型安全的dispatch函数
export const useAppDispatch = () =>  useDispatch<AppDispatch>()
//类型化的useSelector hook
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
